package com.auzingers.docsorganizer.entity;

import android.test.AndroidTestCase;

/** Unit tests for GoogleEntry. */
public class TestGoogleEntry extends AndroidTestCase {

    public void testCompareTo() {
        final GoogleDocument doc = new GoogleDocument();
        final GoogleCollection col = new GoogleCollection();

        //documents must appear after collections
        assertEquals(1, doc.compareTo(col));
        assertEquals(-1, col.compareTo(doc));

        //same type is sorted by title
        final GoogleDocument doc2 = new GoogleDocument();
        doc.setTitle("A");
        doc2.setTitle("A");
        assertEquals(0, doc.compareTo(doc2));

        doc2.setTitle("B");
        assertEquals(-1, doc.compareTo(doc2));
        assertEquals(1, doc2.compareTo(doc));
    }

    public void testGetSimpleResourceId() {
        final GoogleDocument doc = new GoogleDocument();
        doc.setResourceId("folder:123");
        assertEquals("123", doc.getSimpleResourceId());

        doc.setResourceId("456");
        assertEquals("456", doc.getSimpleResourceId());

        doc.setResourceId(null);
        assertNull(doc.getSimpleResourceId());
    }
}
